class Solution:
    def lengthOfLongestSubstring(self, s: str) -> int:
        start, end = 0, 0
        LEN = 0
        while end < len(s):
            if s[end] not in s[start:end]:
                end += 1
            else:
                LEN = max(end-start, LEN)
                start += 1
        LEN = max(end-start, LEN)
        return LEN

if __name__ == '__main__':
    s = Solution()
    print(s.lengthOfLongestSubstring("abcabcbbsbd"))
    print(s.lengthOfLongestSubstring("bbbbbbbb"))
    print(s.lengthOfLongestSubstring("pwwkew"))
    print(s.lengthOfLongestSubstring("a"))
    print(s.lengthOfLongestSubstring(""))
    